package mapEditor.utils;

import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import mapEditor.MapEditor;

public abstract class ValueSpinner extends JSpinner
{ static final long serialVersionUID=0; // AD'HOC
  abstract public void update(double value);
  public ValueSpinner(double value,double MINIMUM,double MAXIMUM,double stepSize)
  { super(new SpinnerNumberModel(value,MINIMUM,MAXIMUM,stepSize));
    addChangeListener(new ChangeListener()
    { public void stateChanged(ChangeEvent e)
      { Double value=(Double)getValue();
   	    update(value.doubleValue()); MapEditor.repaint();
      }	
    });	
  }
}
